package cn.ekgc.angluarssm.controller;

import cn.ekgc.angluarssm.entity.Student;
import cn.ekgc.angluarssm.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author:jeson
 * @date: 2019/7/11 20:33
 * @参数注释：$params$
 * @返回值: $return$
 * @描述:$desciption$
 */
@RestController
@RequestMapping("/student")
public class StudentController {
    @Autowired
    private StudentService studentService;
    @ResponseBody
    @GetMapping("/list")
    public List<Student> list(){
        return studentService.list(null);
    }
    @PostMapping("/save")
    public void save(@RequestBody Student student){
        studentService.save(student);
    }
    @PostMapping("/update")
    public int update(@RequestBody Student student){
        return studentService.update(student);
    }
    @GetMapping("/delete/{id}")
    public void delete(@PathVariable("id") int id){
        studentService.delete(id);
    }


}
